package com.zitangkou.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.experimental.Accessors;

/**
 * 全局错误码
 *
 * @author Deng Ningning
 * @version 1.0
 * @date 2020/8/14 17:32
 */
@Getter
@Accessors(chain = true)
@AllArgsConstructor
public enum RespEnum {

    // 全局
    SUCCESS(0, "操作成功"),
    EXCEPTION(100001, "接口异常"),
    LACK_PARAM(100002, "缺少参数"),
    PARAM_ERROR(100003, "参数错误"),
    AUTHORITY_FAIL(100004, "认证失败"),
    NOT_AUTHORIZATION(100005, "权限不足"),

    // 用户模块
    // 企业 101xxx
    ADD_ENTERPRISE_FAIL(101001, "添加企业失败"),
    EDIT_ENTERPRISE_FAIL(101002, "修改企业失败"),
    DELETE_ENTERPRISE_FAIL(101003, "删除企业失败"),
    ENTERPRISE_ID_NOT_NULL(101004, "企业编号不能为空"),

    // 部门 102xxx
    ADD_DEPARTMENT_FAIL(102001, "添加部门失败"),
    MODIFY_DEPARTMENT_FAIL(102002, "修改部门失败"),
    DELETE_DEPARTMENT_FAIL(102003, "删除部门失败"),
    DEFAULT_DEPARTMENT_NOT_SET(102004, "企业默认部门未设置"),

    // 用户 103xxx
    ADD_USER_FAIL(103001, "添加用户失败"),
    EDIT_USER_FAIL(103002, "修改用户失败"),
    DELETE_USER_FAIL(103003, "删除用户失败"),
    USER_ACCOUNT_DUPLICATE(103004, "账号已存在"),
    MOBILE_DUPLICATE(103005, "手机号码已存在"),
    CODE_TYPE_NOT_EXIST(103006, "验证码类型不存在"),
    CODE_INVALID(103007, "验证码无效"),
    CODE_ERROR(103008, "验证码错误"),
    MOBILE_REGISTER_FAIL(103009, "用户注册失败"),
    PWD_ENCRYPT_FAIL(103010, "密码加密失败"),
    USER_PWD_ERROR(103011, "密码错误"),
    USER_NOT_EXIST(103012, "用户不存在"),
    TOKEN_IS_NULL(103013, "无效用户"),
    TOKEN_EXPIRED(103014, "登录已失效"),
    EMAIL_REGISTER_FAIL(103015, "用户注册失败"),
    EMAIL_DUPLICATE(103016, "邮箱已存在"),
    BIND_MOBILE_FAIL(103017, "绑定手机号码失败"),
    BIND_EMAIL_FAIL(103018, "绑定邮箱失败"),
    USER_CONSTANT_FAIL(103019, "获取用户模块常量失败"),
    FORGOT_PASSWORD_FAIL(103020, "修改密码失败"),

    // 信息模板 104xxx
    ADD_MESSAGE_TEMPLATE_FAIL(104001, "添加信息模板失败"),
    EDIT_MESSAGE_TEMPLATE_FAIL(104002, "修改信息模板失败"),
    DELETE_MESSAGE_TEMPLATE_FAIL(104003, "删除信息模板失败"),
    SEND_EMAIL_FAIL(104004, "发送邮件失败"),

    // 权限 105xxx
    PERMISSION_NAME_DUPLICATE(105001, "权限名称已存在"),
    PERMISSION_VALUE_DUPLICATE(105002, "权限唯一表标识符已存在"),
    DELETE_PERMISSION_FAIL(105003, "删除权限失败"),
    DISABLE_PERMISSION_FAIL(105004, "禁用权限失败"),
    ADD_PERMISSION_FAIL(105005, "新增权限失败"),
    MODIFY_PERMISSION_FAIL(105006, "编辑权限失败"),

    // 微信 106
    GET_ACCESS_TOKEN_FAIL(106001, "获取Access token失败"),
    GET_MENU_TEMPLATE_FAIL(106002, "获取微信公众号菜单模板失败"),
    CREATE_GZH_MENU_FAIL(106003, "创建公众号菜单失败"),

    ;

    private final Integer code;

    private final String msg;
}
